package com.iam.edu.ad.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.iam.edu.ad.entity.PromotionSpace;
import com.iam.edu.ad.mapper.PromotionSpaceMapper;
import com.iam.edu.ad.service.IPromotionSpaceService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author kele
 * @since 2022-10-25
 */
@Service
public class PromotionSpaceServiceImpl extends ServiceImpl<PromotionSpaceMapper, PromotionSpace> implements IPromotionSpaceService {
    @Override
    public PromotionSpace getBySpaceKey(String spaceKey) {

        //根据spaceKey获取PromotionSpace
        LambdaQueryWrapper<PromotionSpace> queryWrapper =  Wrappers.lambdaQuery(PromotionSpace.class)
                .eq(PromotionSpace::getSpaceKey, spaceKey);

        return this.getBaseMapper().selectOne(queryWrapper);
    }
}
